package com.etc.controller;

import com.etc.entity.Address;
import com.etc.service.impl.AddressServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/AddressController")
public class AddressController {
    @Autowired
    AddressServiceImpl service;

    @RequestMapping("/getAddress")
    public List<Address> getAddress(@RequestParam(value = "userId")String userId){
        List<Address> list = service.selectByPrimaryKey(userId);
        return list;
    }
    @RequestMapping("/inAddress")
    public Address inAddress(Address address){
        boolean b = service.insert(address);
        return address;
    }
}
